package org.ezplatform.office.meeting.setting.category.dao;

import java.util.List;

import org.ezplatform.core.dao.jpa.JpaBaseDao;
import org.ezplatform.office.meeting.setting.category.entity.BoardroomCategorySet;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface BoardroomCategorySetDao extends JpaBaseDao<BoardroomCategorySet, String> {

	@Query(value = "from BoardroomCategorySet b where b.id in (?1)")
    List<BoardroomCategorySet> getCategorytSetByIds(List<String> ids);
	
    //验证查询会议室类型名称是否存在
    @Query(value = "from BoardroomCategorySet b where b.id not in(?1) and b.name=?2 and b.corpId=?3")
    List<BoardroomCategorySet> getCategorySetByName(String id, String checkdata, String corpId);

    //验证查询会议室类型名称是否存在
    @Query(value = "from BoardroomCategorySet b where b.name=?1 and b.corpId=?2")
    List<BoardroomCategorySet> getCategorytSetByName(String checkdata, String corpId);
    
    @Query(value = "from BoardroomCategorySet b where b.corpId=?1 order by b.sortNo asc,b.createdDate desc")
    List<BoardroomCategorySet> getCategorySetList(String corpId);
    
    @Query(value = "from BoardroomCategorySet b where b.corpId=?1 and b.isInit=?2 ")
    List<BoardroomCategorySet> getCategoryList(String corpId,String isInit);
    
    @Modifying
    @Query(value = "delete from BoardroomCategorySet b where b.corpId=?1 and b.isInit=?2 ")
    int delCategoryList(String corpId,String isInit);
}